<%--
  Created by IntelliJ IDEA.
  User: Zhou Wenying
  Date: 2023/3/10
  Time: 21:12
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@page isELIgnored="false" %>
<!DOCTYPE html>
<html>
<head>
    <title>旧书交易平台-个人中心</title>
    <meta http-equiv="Expires" content="0">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="pragma" content="no-cache">
</head>
<body>
<!--header-->
<jsp:include page="/page/head2.jsp">
    <jsp:param name="flag" value="7"></jsp:param>
</jsp:include>
<!--//header-->

<body style="background-color: aliceblue;">
<div class="layui-row">
    <div class="layui-col-md2 layui-col-md-offset1">
        <div class="layui-card">
            <div class="layui-card-header">个人信息</div>
            <div class="layui-card-body">
                <div class="layui-form-item">
                    <img width="200px" src="/getImg?img=${user.userImg}">
                </div>
                <div class="layui-form-item">
                    <span>账号：${user.userName}</span>
                </div>
                <div class="layui-form-item">
                    <span>昵称：${user.userNickname}</span>
                </div>
                <div class="layui-form-item">
                    <span>余额：${user.userMoney}</span>
                </div>
                <div class="layui-form-item">
                    <span>邮箱：${user.userEmail}</span>
                </div>
            </div>
        </div>
        <div class="layui-card">
            <div class="layui-card-header">我的默认地址</div>
            <c:if test="${empty checkAddr}">
                <div class="layui-card-body">
                    <div class="layui-form-item">
                        <span>没有设置默认地址</span>
                    </div>
                    <div class="layui-form-item">
                        <a href="/Cart-indent?change=1" style="color: #0e90d2">去添加</a>
                    </div>
                </div>
            </c:if>
            <c:if test="${not empty checkAddr}">
                <div class="layui-card-body">
                    <div class="layui-form-item">
                        <span>名字：${checkAddr.addrName}</span>
                    </div>
                    <div class="layui-form-item">
                        <span>地址：${checkAddr.addrAddr}</span>
                    </div>
                    <div class="layui-form-item">
                        <span>电话：${checkAddr.addrPhone}</span>
                    </div>
                    <div class="layui-form-item">
                        <span>邮箱：${checkAddr.addrMail}</span>
                    </div>
                </div>
            </c:if>
        </div>
    </div>


    <div class="layui-col-md8 layui-col-md-offset1">
        <br>
        <br>
        <div class="layui-row grid-demo">
            <div class="layui-col-md8">
                <div class="layui-panel">
                    <span style="padding:15px 15px 5px ">我的上架</span>
<%--                    <a style="float: right;padding-right: 10px;color: #0a9dbd">更多>></a>--%>
                    <table class="layui-table">
                        <colgroup>
                            <col width="150">
                            <col width="80">
                            <col width="80">
                            <col>
                            <col width="100">
                        </colgroup>

                        <thead>
                        <tr>
                            <th>书名</th>
                            <th>价钱</th>
                            <th>热度</th>
                            <th>上架时间</th>
                            <th>状态</th>
                        </tr>
                        </thead>
                        <tbody id="myUpBook">
                        <c:forEach items="${books}" var="book">
                            <tr>
                                <td>${book.bookName}</td>
                                <td>${book.bookMoney}</td>
                                <td>${book.bookHot}</td>
                                <td>${book.bookCretime}</td>

                                <c:if test="${book.bookCheck == 0}">
                                    <td style="color: blue">未审核</td>
                                </c:if>
                                <c:if test="${book.bookCheck == 1}">
                                    <td style="color: green">通过</td>
                                </c:if>
                                <c:if test="${book.bookCheck == 2}">
                                    <td style="color: red">未通过</td>
                                </c:if>
                            </tr>
                        </c:forEach>
                        </tbody>
                    </table>
                    <div id="myUpBookPage">

                    </div>
                </div>
                <br/><br/>
                <%--<div class="layui-panel">
                    <span style="padding:15px 15px 5px ">我的购买</span>
&lt;%&ndash;                    <a style="float: right;padding-right: 10px;color: #0a9dbd">更多>></a>&ndash;%&gt;
                    <table class="layui-table">
                        <colgroup>
                            <col width="150">
                            <col width="90">
                            <col width="80">
                            <col>
                            <col width="100">
                        </colgroup>
                        <thead>
                        <tr>
                            <th>书籍名称</th>
                            <th>收货人</th>
                            <th>价格</th>
                            <th>创建时间</th>
                            <th>订单状态</th>
                        </tr>
                        </thead>
                        <tbody id="mySellBook">
                        <c:forEach items="${OwnerUserOrder}" var="Owner">
                            <c:forEach items="${Owner.booksList}" var="book">
                                <tr>
                                    <td>${book.bookName}</td>
                                    <td>${addrMap.get(Owner.addressId).addrName}</td>
                                    <td>${book.bookMoney}</td>
                                    <td>${Owner.orderCretime}</td>
                                        &lt;%&ndash;是等待发货，1 部分发货 2全部运送中 3订单完成&ndash;%&gt;
                                    <c:if test="${Owner.orderDeal != 3 && book.status.state == 0}">
                                        <td style="color: blue">等待发货</td>
                                    </c:if>
                                    <c:if test="${Owner.orderDeal != 3 && book.status.state == 1}">
                                        <td style="color: #2eff11">运送中</td>
                                    </c:if>
                                    <c:if test="${Owner.orderDeal == 3}">
                                        <td style="color: green">订单完成</td>
                                    </c:if>
                                </tr>
                            </c:forEach>
                        </c:forEach>
                        </tbody>
                    </table>
                    <div id="mySellBookPage">

                    </div>
                </div>--%>
            </div>
        </div>
    </div>
</div>

<!--footer-->
<jsp:include page="/page/footer.jsp"></jsp:include>
<!--//footer-->

</body>

</html>
<script src="/static/js/layui-page.js"></script>
<script type="text/javascript">
    /*第一个参数是一个CSS选择器，用于指定分页控件所在的DOM元素；
    第二个参数也是一个CSS选择器，用于指定分页控件的页码DOM元素；
    第三个参数是一个整数，表示每页显示的记录数；第四个参数是一个整数，表示总记录数。*/
    new LayuiPage("#myUpBook","#myUpBookPage",10,0);
    // new LayuiPage("#mySellBook","#mySellBookPage",5,0);

</script>